
class Nvm_FpHead(object):

    cfghead = '''#ifndef _NVM_CFG_H_
#define _NVM_CFG_H_

#include "Platform_Types.h"
#include "VDTH_UtilsLog.h"
#undef CFC_INIT_VALUE

#define conv16(data)  uint32 datatmp = ((((data) & 0xFF00) >> 8) + (((data) & 0xFF) << 8)); (data) = datatmp;
#define conv24(data)  uint32 datatmp = ((((data) & 0xFF0000) >> 16) + ((data) & 0xFF00) + (((data) & 0xFF) << 16)); (data) = datatmp;
#define conv32(data)  uint32 datatmp = ((((data) & 0xFF000000) >> 24) + (((data) & 0xFF0000) >> 8) + (((data) & 0xFF00) << 8) + (((data) & 0xFF) << 24)); (data) = datatmp;
    


'''


    datahdef = '''#ifndef _NVM_DATA_H_
#define _NVM_DATA_H_

#include "Nvm_al_cfg.h"

#undef EXTERN
#ifndef _NVM_DATA_C_
#define EXTERN extern
#else
#define EXTERN
#endif

'''
    datacdef = '''#ifndef _NVM_DATA_C_
#define _NVM_DATA_C_

#include "Nvm_data.h"

#pragma pack(push)
#pragma pack(1)

'''

    headdef = '''#ifndef _%s_H_
#define _%s_H_

#include "Nvm_data.h"

#undef EXTERN
#ifndef _%s_C_
#define EXTERN extern
#else
#define EXTERN
#endif

'''

    cdef = '''#ifndef _%s_C_
#define _%s_C_

#include "%s.h"

'''

    headinfo = '''// 该文件由MCU工具链NVM模块生成,请勿手动修改!
// base 数据文件: %s
// 生成日期     : %s

'''
    def __init__(self):
        print('Nvm_FpHead init ...')

    def GetHeadDef(self, name:str):
        return self.headdef % (name.upper(), name.upper(), name.upper())

    def GetcDef(self, name:str):
        return self.cdef % (name.upper(), name.upper(), name)